# 引入拷贝逻辑
include(${CMAKE_CURRENT_SOURCE_DIR}/build_scripts/CopyFiles.cmake)

set(DLL_SOURCE_DIR "${CMAKE_SOURCE_DIR}/assets/libs")

if (EXISTS ${DLL_SOURCE_DIR}) # 判断文件或目录是否存在
    # CopyDLLs.cmake
    file(GLOB DLL_FILES "${DLL_SOURCE_DIR}/*.dll")
    # 拷贝库文件
    copy_files_to_target(TARGET ${CMAKE_PROJECT_NAME} FILES ${DLL_FILES})
endif()

if(VCPKG_TARGET_TRIPLET STREQUAL "x64-mingw-static")
    if (EXISTS "$ENV{MINGW_ROOT_X64}")
        file(GLOB X64_MINGW_DLL_LIST "$ENV{MINGW_ROOT_X64}/*.dll")
        copy_files_to_target(TARGET ${CMAKE_PROJECT_NAME} FILES ${X64_MINGW_DLL_LIST})
    endif()
elseif(VCPKG_TARGET_TRIPLET STREQUAL "x86-mingw-static")
    if (EXISTS "$ENV{MINGW_ROOT_X86}")
        file(GLOB X86_MINGW_DLL_LIST "$ENV{MINGW_ROOT_X86}/*.dll")
        copy_files_to_target(TARGET ${CMAKE_PROJECT_NAME} FILES ${X86_MINGW_DLL_LIST})
    endif()
endif()